Skip to content

Conversation

@calm329
Copy link

@calm329 calm329 commented Jan 6, 2026

Fixes #105625

Summary

The SDK crash detection was incorrectly reporting crashes as SDK crashes when SentrySwizzleWrapper was the only SDK frame in the stacktrace. These are false positives because SentrySwizzleWrapper is an instrumentation frame that intercepts UI events but doesn't cause crashes itself.

This PR adds a new conditional SDK frame detection mechanism that only ignores SentrySwizzleWrapper when there are no other SDK frames above it (closer to the crash origin).

Changes

  • Added sdk_crash_ignore_when_only_sdk_frame_matchers field to SDKCrashDetectionConfig
  • Modified is_sdk_crash() in SDKCrashDetector to handle conditional SDK frames
  • Added SentrySwizzleWrapper pattern to Cocoa SDK configuration
  • Added CocoaSDKSwizzleWrapperTestMixin with 3 test cases:
    • SwizzleWrapper as only SDK frame → NOT reported
    • SwizzleWrapper with SDK frames above → IS reported
    • SwizzleWrapper with SDK frames below → NOT reported

How it works

When iterating through frames (youngest to oldest):

  1. If a non-conditional SDK frame is found → return True (SDK crash)
  2. If a conditional SDK frame (like SwizzleWrapper) is found → return False (not SDK crash, since any SDK frames above would have triggered step 1)
  3. If a non-system frame is found → return False

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.


Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=148254234

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 6, 2026
@calm329
Copy link
Author

calm329 commented Jan 7, 2026

@philipphofmann I’ve opened this PR and would appreciate a review when you have a chance. Thanks!

Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for tackling this @calm329. I added a few comments.

@calm329
Copy link
Author

calm329 commented Jan 9, 2026

@philipphofmann I've fixed according to your feedback, could you review it again?

Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for including the feedback. We're not far away from an approval, @calm329 💯

@philipphofmann philipphofmann added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Jan 13, 2026
@philipphofmann
Copy link
Member

philipphofmann commented Jan 13, 2026

@calm329, I went ahead and addressed https://github.com/getsentry/sentry/pull/105705/changes#r2682659766 with a few commits. Otherwise, we most likely would go back and forth a few times. I hope that's OK for you.

When the tests are green, I will give this a final pass and approve.

@github-actions github-actions bot removed the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Jan 13, 2026
@philipphofmann philipphofmann added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDK Crashes: Ignore false positive for SentrySwizzleWrapper

2 participants